package com.baizhi.service.impl;

import cn.hutool.log.Log;
import com.baizhi.dao.LogDao;
import com.baizhi.entity.LogRecord;
import com.baizhi.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogDao logDao;
    @Override
    public Map selectAllLog(Integer page, Integer limit) {
        Map map=new HashMap();
        int  offset=(page-1)*limit;
        List<LogRecord> logRecords = logDao.selectAllLog(offset, limit);
        int i = logDao.countLog();
        map.put("data",logRecords);
        map.put("msg","");
        map.put("count",i);
        map.put("code",0);
        return map;
    }

    @Override
    public void insertLog(LogRecord logRecord) {
        logDao.insertLog(logRecord);
    }
}
